package com.niuke;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

/**
 * 55. 数字序列比大小
 * https://blog.csdn.net/qfc_128220/article/details/131185797
 */
public class NiukeMoni55 {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        int len = Integer.parseInt(scanner.nextLine()); // 数字序列长度

        String[] input1 = scanner.nextLine().split(" "); // A的数字序列输入
        String[] input2 = scanner.nextLine().split(" "); // B的数字序列输入

        List<Integer> a = new ArrayList<>();
        int[] b = new int[len];

        for (int i = 0; i < len; i++) {
            a.add(Integer.parseInt(input1[i]));
            b[i] = Integer.parseInt(input2[i]);
        }

        // 倒序
        a.sort(new Comparator<Integer>() {
            @Override
            public int compare(Integer integer, Integer t1) {
                return t1 - integer;
            }
        });
        Arrays.sort(b);

        int result = 0;


        // 田忌赛马 的原理
        out:
        for (int i = len - 1; i >= 0; i--) {
            int currB = b[i];

            if (currB >= a.get(0)) {
                if (currB > a.get(a.size() - 1)) { // 可能相等
                    result -= 1;
                }
                a.remove(a.size() - 1);
            } else { // 肯定可以得分的情况
                for (int j = 0; j < a.size(); j++) {
                    if (j == a.size() - 1 && a.get(j) > currB) { // 剩下的都可以得分
                        result += a.size();
                        break out;
                    } else if (a.get(j) <= currB) {
                        result += 1;
                        a.remove(j - 1);
                        break;
                    }
                }
            }
        }

        System.out.println(result);

    }

}
